package cn.net.xyan.easy.webapp.base.frontend.ui.editor;

import cn.net.xyan.easy.webapp.base.api.dto.CommitRegisterUserReq;
import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.Editor;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import org.gwtbootstrap3.client.ui.Input;
import org.gwtbootstrap3.client.ui.TextBox;

/**
 * Created by xiashenpin on 16/3/27.
 */
public class NewUserEditor extends Composite implements Editor<CommitRegisterUserReq> {

    @UiTemplate("NewUserEditor.ui.xml")
    interface Binder extends UiBinder<Widget, NewUserEditor > {}

    private static Binder binder = GWT.create(Binder.class);

    @UiField
    @Path(value = "username")
    TextBox username;

    @UiField
    @Path(value = "password")
    Input password;

    @UiField
    @Path(value = "email")
    TextBox email;

    @UiField
    @Path(value = "realName")
    TextBox realName;

    @UiConstructor
    public NewUserEditor(){
        initWidget(binder.createAndBindUi(this));
        //init();
    }

    public void resetAllValues(){
        username.setValue("");
        password.setValue("");
        email.setValue("");
        realName.setValue("");
    }


}
